The present disclosure relates generally to image compression. In particular, the present disclosure relates to determining the number of resolution levels, and scaling compressed images to fit a target size.
In a hierarchical image compression software tool, such as JPEG2000, image compression is performed using multiple resolution levels in a hierarchical fashion that allows decoding to a lower resolution. An original image is wavelet transformed to create four first subband images which replace the original image and may be used to recreate the original image. FIG. 1 shows a representation of an image that was compressed with two resolution levels of compression. The first four subbands are LL1, LH1, HL1 and HH1.
One of the first subbands (e.g., LL1) is wavelet transformed to create four second subband images, shown in FIG. 1 as LL2, LH2, HL2 and HH2, which are capable of replacing the first subband that was wavelet transformed (e.g., LL1). The process of using wavelet transformation to transform successive subband images (LL images) may be continued, with each wavelet transformation corresponding to a resolution level of compression, where the JPEG2000 standard allows up to 32 resolution levels. JPEG2000 creates a compressed image by quantizing and entropy encoding the subband images.
A compressed image is decompressed by a JPEG2000 decoder software module for displaying the image at one of the available resolution levels. For example, to display an image that is 1/16th the size of the original image, the JPEG2000 decoder accesses and decompresses just the LL2 subband. To display an image that is ¼th the size of the original image, the JPEG2000 decoder accesses and decompresses the LH2, HL2 and HH2 subband images and combines them with the LL2 subband image to recreate the LL1 subband image.
The dimensions (e.g., number of pixels per line (width (W)) and number of lines (height (H))) of each subband image depend on the corresponding dimensions of the original image. The number of resolution levels is determined manually so that a lowest resolution image (e.g., a thumbnail) having target dimensions can be generated for a first original image having a typical size, e.g., the dimensions of a page. Accordingly, if a second original image having an atypical size is compressed using the same number of resolution levels as was determined above, the dimensions of a lowest resolution image generated for the second original image will have dimensions that are different from the dimensions of the lowest resolution image generated for the first original image. If a constraint exists for the size of the lowest resolution image generated for the second original image, e.g., to be sized the same as the thumbnail size used above, the number of resolution levels must be determined anew.
Furthermore, in various applications, even when the original image is always of a standard size, the constraints for the size of the lowest resolution image may vary for the different applications. The number of resolution levels must be determined for each case, bearing in mind that providing extra resolution levels is undesirable due to the strain they can place on available resources. Additionally, since a compressed image is always ¼ the size of an image of the next highest resolution level, it might be impossible for the lowest resolution image to have a specified target dimension
To overcome the drawbacks in the prior art, it is an aspect of the present disclosure to provide a system and method for automatically determining the number of resolution levels to use when compressing an original image that is appropriate for a variety of applications, including generating a target image that is sized to substantially meet a dimension constraint.